var openUserPopWin = function(id,name,multi){
	var contentUrl=SERVER_URL+"templates/popwin/userpopwin.html";
	if(multi){
		contentUrl=SERVER_URL+"templates/popwin/multiuserpopwin.html";
	}
	layer.open({
		type:2,
		title:"选择用户",
		area : [ '800px', '450px' ],
		content:contentUrl,
		success: function(layero, index){
			var body = layer.getChildFrame('body',index);//建立父子联系
			$(body).find('input[id=idInput]').val(id);
			$(body).find('input[id=nameInput]').val(name);
       }
	})

}
var openUserPopWinProject = function(id,name,multi,checkedIds){

    var contentUrl=SERVER_URL+"templates/popwin/userpopwin.html";
    if(multi){
        contentUrl=SERVER_URL+"templates/popwin/multiuserpopwinproject.html";
    }
    layer.open({
        type:2,
        title:"选择用户",
        area : [ '800px', '450px' ],
        content:contentUrl,
        success: function(layero, index,multi){
            var body = layer.getChildFrame('body',index);//建立父子联系
            $(body).find('input[id=idInput]').val(id);
            $(body).find('input[id=nameInput]').val(name);
            if(checkedIds){
                 var iframeWin = window[layero.find('iframe')[0]['name']];
                 iframeWin.setCheckNodes(checkedIds);
            }
        }
    });

}

// var back_function;
// var openUserPopWin = function(id,name,multi){
//     var contentUrl=SERVER_URL+"templates/popwin/userpopwin.html";
//     if(multi){
//         contentUrl=SERVER_URL+"templates/popwin/multiuserpopwin.html";
//     }
//     layer.open({
//         type:2,
//         title:"选择用户",
//         area : [ '800px', '450px' ],
//         content:contentUrl,
//         success: function(layero, index){
//             var body = layer.getChildFrame('body',index);//建立父子联系
//             $(body).find('input[id=idInput]').val(id);
//             $(body).find('input[id=nameInput]').val(name);
//         }
//     })
//
// }

// var backfunction = function(){
//
//
// }
// var openUserPopWin = function(id,name,multi,){
//     var contentUrl=SERVER_URL+"templates/popwin/userpopwin.html";
//     if(multi){
//         contentUrl=SERVER_URL+"templates/popwin/multiuserpopwin.html";
//     }
//     layer.open({
//         type:2,
//         title:"选择用户",
//         area : [ '800px', '450px' ],
//         content:contentUrl,
//         success: function(layero, index){
//             var body = layer.getChildFrame('body',index);//建立父子联系
//             $(body).find('input[id=idInput]').val(id);
//             $(body).find('input[id=nameInput]').val(name);
//         }
//     })
// }

var openCustomerPopWin = function(id,name,multi){
	var contentUrl=SERVER_URL+"templates/popwin/customerpopwin.html";
	if(multi){
		contentUrl=SERVER_URL+"templates/popwin/multicustomerpopwin.html";
	}
	layer.open({
		type:2,
		title:"选择客户",
		area : [ '800px', '450px' ],
		content:contentUrl,
		success: function(layero, index){
			var body = layer.getChildFrame('body',index);//建立父子联系
			$(body).find('input[id=idInput]').val(id);
			$(body).find('input[id=nameInput]').val(name);
       }
	})
}

var openCiPopWin = function(id,version,name,multi,projectId,areaId){
	var contentUrl=SERVER_URL+"templates/popwin/cipopwin.html";
	if(multi){
		contentUrl=SERVER_URL+"templates/popwin/multicipopwin.html";
	}
	layer.open({
		type:2,
		title:"选择配置项",
		area : [ '800px', '450px' ],
		content:contentUrl,
		success: function(layero, index){
			var body = layer.getChildFrame('body',index);//建立父子联系
			$(body).find('input[id=idInput]').val(id);
			$(body).find('input[id=versionInput]').val(version);
			$(body).find('input[id=nameInput]').val(name);
			$(body).find('input[id=projectId]').val(projectId);
			$(body).find('input[id=areaId]').val(areaId);
            var iframeWin = window[layero.find('iframe')[0]['name']];
            iframeWin.init();
       }
	})
}

var openCategoryPopWin = function(id,name,topCode){
	var contentUrl=SERVER_URL+"templates/popwin/categorypopwin.html";
	layer.open({
		type:2,
		title:"选择分类",
		area : [ '500px', '450px' ],
		content:contentUrl,
		success: function(layero, index){
			var body = layer.getChildFrame('body',index);//建立父子联系
			$(body).find('input[id=idInput]').val(id);
			$(body).find('input[id=nameInput]').val(name);
			$(body).find('input[id=topCode]').val(topCode);
            var iframeWin = window[layero.find('iframe')[0]['name']];
            iframeWin.init();
       }
	})
}

var openCmmPopWin = function(id,name){
	var contentUrl=SERVER_URL+"templates/popwin/cmmpopwin.html";
	layer.open({
		type:2,
		title:"选择项目",
		area : [ '500px', '450px' ],
		content:contentUrl,
		success: function(layero, index){
			var body = layer.getChildFrame('body',index);//建立父子联系
			$(body).find('input[id=idInput]').val(id);
			$(body).find('input[id=nameInput]').val(name);
       }
	})
}

var opendepotPopWin = function(id,name){
    var contentUrl=SERVER_URL+"templates/popwin/depotpopwin.html";
    	layer.open({
    		type:2,
    		title:"选择库房类型",
    		area : [ '500px', '450px' ],
    		content:contentUrl,
    		success: function(layero, index){
    			var body = layer.getChildFrame('body',index);//建立父子联系
                $(body).find('input[id=idInput]').val(id);
                $(body).find('input[id=nameInput]').val(name);
                var iframeWin = window[layero.find('iframe')[0]['name']];
                iframeWin.init();
           }
    	})
}
var openAreaPopWin = function(id,name){
	var contentUrl=SERVER_URL+"templates/popwin/areapopwin.html";
	layer.open({
		type:2,
		title:"选择区域",
		area : [ '500px', '450px' ],
		content:contentUrl,
		success: function(layero, index){
			var body = layer.getChildFrame('body',index);//建立父子联系
			$(body).find('input[id=idInput]').val(id);
			$(body).find('input[id=nameInput]').val(name);
       }
	})
}


var openProCategoryPopWin = function(id,name){
    var contentUrl=SERVER_URL+"templates/popwin/projectcategorypopwin.html";
    layer.open({
        type:2,
        title:"选择项目分类",
        area : [ '500px', '450px' ],
        content:contentUrl,
        success: function(layero, index){
            var body = layer.getChildFrame('body',index);//建立父子联系
            $(body).find('input[id=idInput]').val(id);
            $(body).find('input[id=nameInput]').val(name);
        }
    })
}

var openProjectPopWin = function(id,name,multi,customerId){
	var contentUrl=SERVER_URL+"templates/popwin/projectpopwin.html";
	if(multi){
		contentUrl=SERVER_URL+"templates/popwin/multiprojectpopwin.html";
	}
	layer.open({
		type:2,
		title:"选择项目",
		area : [ '800px', '450px' ],
		content:contentUrl,
		success: function(layero, index){
			var body = layer.getChildFrame('body',index);//建立父子联系
			$(body).find('input[id=idInput]').val(id);
			$(body).find('input[id=nameInput]').val(name);
			$(body).find('input[id=customerId]').val(customerId);
			var iframeWin = window[layero.find('iframe')[0]['name']];
			iframeWin.init();
       }
	})
}


var openSLAWin = function(projectId,id,name){
	var contentUrl=SERVER_URL+"templates/popwin/slapopwin.html";
	layer.open({
		type:2,
		title:"选择SLA等级",
		area : [ '500px', '450px' ],
		content:contentUrl,
		success: function(layero, index){
			var body = layer.getChildFrame('body',index);//建立父子联系
			$(body).find('input[id=idInput]').val(id);
			$(body).find('input[id=nameInput]').val(name);
			$(body).find('input[id=projectIdInput]').val(projectId);
			var iframeWin = window[layero.find('iframe')[0]['name']];
			iframeWin.init();
       }
	})
}

var openSupplierPopWin = function(id,name,multi){
	var contentUrl=SERVER_URL+"templates/popwin/supplierpopwin.html";
	if(multi){
		contentUrl=SERVER_URL+"templates/popwin/multisupplierpopwin.html";
	}
	layer.open({
		type:2,
		title:"选择供货商",
		area : [ '800px', '450px' ],
		content:contentUrl,
		success: function(layero, index){
			var body = layer.getChildFrame('body',index);//建立父子联系
			$(body).find('input[id=idInput]').val(id);
			$(body).find('input[id=nameInput]').val(name);
       }
	})
}

var openUserInfoPopWin = function(id){
	var contentUrl=SERVER_URL+"templates/popwin/userinfopopwin.html";
	layer.open({
		type:2,
		title:"用户名片",
		area : [ '900px', '500px' ],
		content:contentUrl,
		success: function(layero, index){
			var body = layer.getChildFrame('body',index);//建立父子联系
			$(body).find('input[id=idInput]').val(id);
 			var iframeWin = window[layero.find('iframe')[0]['name']];
 			iframeWin.init();
       }
	})
}

var openSendMsgPopWin = function(id){
	var contentUrl=SERVER_URL+"templates/wb/msg/sendmsgpopwin.html";
	layer.open({
		type:2,
		title:"发送消息",
		area : [ '800px', '450px' ],
		content:contentUrl,
		success: function(layero, index){
			var body = layer.getChildFrame('body',index);//建立父子联系
			$(body).find('input[id=userId]').val(id);
 			var iframeWin = window[layero.find('iframe')[0]['name']];
 			iframeWin.init();
       }
	})
}

var openDictPopWin = function(type,description){
	var contentUrl=SERVER_URL+"templates/popwin/dictpopwin.html";
	layer.open({
		type:2,
		title:"选择字典类型",
		area : [ '800px', '450px' ],
		content:contentUrl,
		success: function(layero, index){
			var body = layer.getChildFrame('body',index);//建立父子联系
			$(body).find('input[id=typeInput]').val(type);
			$(body).find('input[id=descriptionInput]').val(description);
            var iframeWin = window[layero.find('iframe')[0]['name']];
            iframeWin.init();
       }
	})
}